// TypeScript file

class More extends eui.Component {
    
    private btn:eui.Button;
    public context: MainPanel
    public moreUI:MoreUI;

    public constructor(context: MainPanel) 
    {
        super();
        this.skinName = "more_btn_new";
        this.context = context;
        this.addEventListener(egret.Event.ADDED_TO_STAGE, this.onAddToStage, this);
    }

    private onAddToStage(event: egret.Event) 
    {
        this.removeEventListener(egret.Event.ADDED_TO_STAGE, this.onAddToStage, this);

        this.btn.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onMoreBtnEvent,this)
        this.moreUI = new MoreUI(this.context);
        this.moreUI.x = this.context.width/2  - this.moreUI.width*0.5/2;
        this.moreUI.y = this.context.height/2  - this.moreUI.height*0.5/2;
        this.moreUI.$setScaleX(0.5);
        this.moreUI.$setScaleY(0.5);
        this.moreUI.$setVisible(false);
        this.context.addChild(this.moreUI);

    }

    private onMoreBtnEvent(event: egret.Event)
    {
          this.moreUI.setBetShow();
          this.moreUI.$setVisible(true);
          this.moreUI.context.soundctr.playSound("click_mp3");
    }

    public visibleMore()
    {

        this.moreUI.$setVisible(true);
    }

    public setTouchEvent(enable:boolean)
    {
        this.touchEnabled = enable;
        this.touchChildren = enable;
    }


}